home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / zoome / zoome.c < prev   
Encoding:
C/C++ Source or Header  |  1992-12-26  |  1.7 KB  |  87 lines

  1. #include <exec/types.h>
  2. #include <exec/exec.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "work:romconf/doorheader.h"
  6. #define gu getuserstring
  7. #define pm prompt
  8. #define hk hotkey
  9. #define sm sendmessage
  10. char cmd[200];
  11. void end();
  12. FILE *fi=NULL;
  13. void sr(char *str);
  14. main(int argc, char *argv[])
  15. {
  16.  
  17.   long Position;
  18.   
  19.  
  20.   if(argc!=2)
  21.   {
  22.      printf("\n");
  23.      printf("Zoom Edit v1.0, written by Joseph Hodge\n");
  24.      printf("This is a door for AmiExpress v1.1w+\n");
  25.      printf("\n");
  26.      exit(0);
  27.   } 
  28.   Register(argv[1][0]-'0');
  29.   sm("ZOOM-EDIT v1.0, written by Joseph Hodge",1);
  30.   sm("",1);
  31.   fi=fopen("DOORS:ZOOME/ZOOM.Mail","r");
  32.   if(fi==NULL)
  33.   {
  34.     sm("",1);
  35.     sm("No mail to process!!",1);
  36.     sm("",1);
  37.     ShutDown();
  38.     end();
  39.   }
  40.   Position=ftell(fi);
  41.   while(fgets(cmd,80,fi)!=NULL)
  42.   {
  43.      sr(cmd);
  44.      if(!strncmp(cmd,"=====",5))
  45.      {
  46.         sm("",1);
  47.         sm("a)bort, r)eply, C)ontinue >:",0);
  48.         hk("",cmd);
  49.         if(cmd[0]<' ' || cmd[0]=='C' || cmd[0]=='c') 
  50.         { sm("Continue.",1); sm("",1); Position=ftell(fi);continue; }
  51.         if(cmd[0]=='r' || cmd[0]=='R')
  52.         {
  53.            sm("Reply. (not implemented)",1);
  54.            sm("",1);
  55.            Position=ftell(fi);
  56.            continue;
  57.         }
  58.         if(cmd[0]=='A' || cmd[0]=='a')
  59.         {
  60.           sm("Abort.",1); sm("",1); fclose(fi); ShutDown(); end(); 
  61.         }
  62.      }
  63.      else
  64.      sm(cmd,1);
  65.   }
  66.   fclose(fi);fi=NULL;
  67.   ShutDown();
  68.   end();
  69.         
  70.  
  71. void end()
  72. {
  73.   if(fi!=NULL) fclose(fi);
  74.   exit(0);
  75.  
  76. void sr(char *str)
  77. {
  78.   register int i;
  79.   i=strlen(str)-1;
  80.   while(i)
  81.   {
  82.     if(*(str+i)<=' ') *(str+i)='\0'; else break;
  83.     i--;
  84.   }
  85. }